import random
import time

end_time = "105500"  # 结束时间
end_hour, end_minute, end_second = int(end_time[:2]), int(end_time[2:4]), int(end_time[4:])  # 将结束时间转换为小时、分钟、秒

current_time = time.strftime("%H%M%S", time.localtime())  # 获取当前时间，格式为"HHMMSS"
current_hour, current_minute, current_second = int(current_time[:2]), int(current_time[2:4]), int(current_time[4:])  # 将当前时间转换为小时、分钟、秒

# 计算当前时间距离结束时间的秒数
remaining_seconds = (end_hour - current_hour) * 3600 + (end_minute - current_minute) * 60 + (end_second - current_second)

# 随机生成一个在当前时间和结束时间之间的时间
random_seconds = random.randint(0, remaining_seconds)
random_time = time.strftime("%H%M%S", time.localtime(time.time() + random_seconds))  # 将时间戳转换为"HHMMSS"格式

print("随机生成的时间为：", random_time)
